#include<stdio.h>
#include<malloc.h>

int main()
{
    int a,n,nowNum,sumNum=0;
    int *pa=&a,*pn=&n,*temp,*pnow=&nowNum,*psum=&sumNum;
    temp=(int*)malloc(sizeof(int));    //堆区分配内存，不直接指向栈区i的内存
    scanf("a=%d,n=%d",pa,pn);
    for(int i=1;i<=n;i++){
        *temp=i;
        *pnow=0;
        while(*temp)
        {
            printf("%d",*pa);
            (*temp)=*(temp)-1;
            *pnow=(*pnow)*10+(*pa);
        }
        printf("\n");
        *psum=*psum+*pnow;
    }
    printf("sum=%d",*psum);
}